package com.gzx.plugin.tjzy.modular.call.receipt.controller;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gzx.plugin.tjzy.modular.call.receipt.bo.GzxHtCallReceiptQueryBo;
import com.gzx.plugin.tjzy.modular.call.receipt.service.GzxHtCallReceiptBusinessService;
import com.gzx.plugin.tjzy.modular.call.receipt.vo.GzxHtCallReceiptBusinessVo;
import com.gzx.plugin.tjzy.modular.call.receipt.vo.GzxHtCallReportVo;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import vip.xiaonuo.common.annotation.CommonLog;
import vip.xiaonuo.common.pojo.CommonResult;

/**
 * @author zjt
 * @description
 * @date 2025/3/31 17:25
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/tjzy/call/receipt/business")
@DS("tjzy-async")
public class GzxHtCallReceiptBusinessController {

    private final GzxHtCallReceiptBusinessService htCallReceiptBusinessService;

    /**
     * 分页查询话单记录
     *
     * @param htCallReceiptQueryBo
     */
    @PostMapping("/pageList")
    public CommonResult<Page<GzxHtCallReceiptBusinessVo>> pageList(@RequestBody GzxHtCallReceiptQueryBo htCallReceiptQueryBo) {
        return CommonResult.data(htCallReceiptBusinessService.pageList(htCallReceiptQueryBo));
    }

    /**
     * 获取通话记录
     *
     * @param htCallReceiptQueryBo
     * @return
     */
    @CommonLog("坐席工作报表查询")
    @PostMapping("/report/page")
    public CommonResult<Page<GzxHtCallReportVo>> pageCallReport(@RequestBody GzxHtCallReceiptQueryBo htCallReceiptQueryBo) {
        return CommonResult.data(htCallReceiptBusinessService.pageCallReport(htCallReceiptQueryBo));
    }

    /**
     * 导出通话记录
     *
     * @param htCallReceiptQueryBo
     * @param response
     */
    @PostMapping("/report/export")
    public void exportCallReport(@RequestBody GzxHtCallReceiptQueryBo htCallReceiptQueryBo, HttpServletResponse response) {
        htCallReceiptBusinessService.exportCallReport(htCallReceiptQueryBo, response);
    }

    /**
     * 获取通话记录
     *
     * @param htCallReceiptQueryBo
     * @return
     */
    @CommonLog("坐席工作报表查询")
    @PostMapping("/report/pageOld")
    public CommonResult<Page<GzxHtCallReportVo>> pageCallReportOld(@RequestBody GzxHtCallReceiptQueryBo htCallReceiptQueryBo) {
        return CommonResult.data(htCallReceiptBusinessService.pageCallReportOld(htCallReceiptQueryBo));
    }

    /**
     * 导出通话记录
     *
     * @param htCallReceiptQueryBo
     * @param response
     */
    @PostMapping("/report/export/old")
    public void exportCallReportOld(@RequestBody GzxHtCallReceiptQueryBo htCallReceiptQueryBo, HttpServletResponse response) {
        htCallReceiptBusinessService.exportCallReportOld(htCallReceiptQueryBo, response);
    }

}
